import 'package:flutter/material.dart';

void main() {
  // 1. 运行应用程序。
  runApp(const MaterialApp(
    home: Main(),
  ));
}

class Main extends StatelessWidget {
  const Main({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          'Image 组件-网络图',
          style: TextStyle(color: Colors.white),
        ),
        backgroundColor: Colors.purple,
      ),
      body: Center(
        child: Container(
          width: 300,
          height: 400,
          color: Colors.amber,
          child: Image.network(
            'https://yanxuan-item.nosdn.127.net/e529b6ab111ade9da9314867f98d360f.png',
            // width: 200, // 以 Container 的为准
            // height: 200,
            fit: BoxFit.contain,
          ),
        ),
      ),
    );
  }
}
